$(function () {
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#commentBeginTime' //指定元素
        });
        laydate.render({
            elem: '#commentEndTime' //指定元素
        });
    })

    //表单验证
    $("#form-article-add").validate({
        rules: {
            articleTitle: {
                required: true
            },
            prefTitle: {
                required: true,
            },
            commentBeginTime: {
                required: true
            },
            commentEndTime: {
                required: true
            }
        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler: function (form) {
            $(form).append("allowComments", $('#allowComments').prop('checked'));
            $(form).ajaxSubmit();
            var index = parent.layer.getFrameIndex(window.name);
            //parent.$('.btn-refresh').click();
            parent.layer.close(index);
        }
    });


});